<?php

require_once('lib/Schedule.php');
require_once('lib/MixiAppliAPI.php');

$api = new MixiAppliAPI(array_merge($_GET, $_POST));

$api->validate_params(array(
    'member_id'  => array('not_blank', 'not_space_only'),
    'start_date' => array('date'),
    'end_date'   => array('not_blank', 'date'),
));

$member_id_ary  = explode('-', $api->params['member_id']);
$counts = array();
foreach ($member_id_ary as $member_id) {
    if (!is_numeric($member_id))
        continue;
    $counts[$member_id] = Schedule::get_count($member_id, $api->params['start_date'], $api->params['end_date']);
}

$api->set_result($counts);

?>
